package org.example.redis.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MybatisConfig {
/**
 * 配置MybatisPlus拦截器，主要用于实现分页功能
 * @return MybatisPlusInterceptor 拦截器实例
 */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
    // 创建MybatisPlus拦截器对象
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
    // 添加MySQL数据库的分页插件
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
    // 返回配置完成的拦截器
        return interceptor;
    }
}
